<?php

declare(strict_types=1);

/*
 * This file is part of eelly package.
 *
 * (c) eelly.com
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Eelly\SDK\User\Api;

use Eelly\SDK\EellyClient;

class AutoSendCoupon
{
    /**
     * 发送卡券
     *
     * @param array $data 数据
     * @return boolean
     * 
     * @author sunanzhi <sunanzhi@hotmail.com>
     * @since 2019.12.9
     */
    public static function sendCoupon(array $data): bool
    {
        return EellyClient::requestJson('user/autoSendCoupon', __FUNCTION__, ['data' => $data]);
    }

    /**
     * 网络端发送卡券
     *
     * @param array $data 数据
     * @return boolean
     * 
     * @author sunanzhi <sunanzhi@hotmail.com>
     * @since 2019.12.12
     */
    public static function httpSendCoupon(array $data): bool
    {
        return EellyClient::requestJson('user/autoSendCoupon', __FUNCTION__, ['data' => $data]);
    }

    /**
     * 获取用户微信卡券
     *
     * @param integer $userId 用户id
     * @return array
     * 
     * @author sunanzhi <sunanzhi@hotmail.com>
     * @since 2019.12.12
     */
    public function getWechatCoupon(int $userId): array
    {
        return EellyClient::requestJson('user/autoSendCoupon', __FUNCTION__, ['userId' => $userId]);
    }

    /**
     * 获取用户微信失效卡券
     *
     * @param integer $userId 用户id
     * @return array
     * 
     * @author sunanzhi <sunanzhi@hotmail.com>
     * @since 2019.12.13
     */
    public function getWechatInvalidCoupon(int $userId): array
    {
        return EellyClient::requestJson('user/autoSendCoupon', __FUNCTION__, ['userId' => $userId]);
    }
}
